home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic 4 Database How-To
/
Visual Basic 4 Database - How-to (The Waite Group)(1995).iso
/
newgroup.fr_
/
newgroup.fr
Wrap
Text File
|
1995-07-06
|
4KB
|
139 lines
VERSION 4.00
Begin VB.Form Form1
BackColor = &H00C0C0C0&
Caption = "Create Group"
ClientHeight = 2100
ClientLeft = 1080
ClientTop = 1530
ClientWidth = 4980
BeginProperty Font
name = "MS Sans Serif"
charset = 0
weight = 700
size = 8.25
underline = 0 'False
italic = 0 'False
strikethrough = 0 'False
EndProperty
Height = 2505
Left = 1020
LinkTopic = "Form1"
ScaleHeight = 2100
ScaleWidth = 4980
Top = 1185
Width = 5100
Begin VB.TextBox txtGroupName
Height = 315
Left = 2160
TabIndex = 3
Top = 360
Width = 2115
End
Begin VB.CommandButton cmdClose
Cancel = -1 'True
Caption = "Cl&ose"
Height = 555
Left = 2520
TabIndex = 2
Top = 1080
Width = 1755
End
Begin VB.CommandButton cmdCreateGroup
Caption = "&Create Group"
Default = -1 'True
Height = 555
Left = 480
TabIndex = 1
Top = 1080
Width = 1755
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
AutoSize = -1 'True
BackColor = &H00C0C0C0&
Caption = "&Group name:"
Height = 195
Left = 780
TabIndex = 0
Top = 420
Width = 1095
End
End
Attribute VB_Name = "Form1"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Option Explicit
#If Win32 Then
Private Declare Function GetWindowsDirectory Lib "kernel32" _
Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, _
ByVal nSize As Long) As Long
#Else
Private Declare Function GetWindowsDirectory Lib "Kernel" _
(ByVal lpBuffer As String, _
ByVal nSize As Integer) As Integer
#End If
Private Sub Form_Load()
Dim myUser As String, myPass As String
Dim winDir As String * 128
Dim dirLen As Integer
' On Error GoTo LoadError
' Get the Windows directory and set the INI path.
dirLen = GetWindowsDirectory(winDir, 128)
If dirLen = 0 Then Error 32767
DBEngine.IniPath = Left$(winDir, dirLen) & "\VBDBHT.INI"
' Set the user and passwords for initial login.
myUser = "Admin"
myPass = "theboss"
DBEngine.DefaultUser = myUser
DBEngine.DefaultPassword = myPass
Exit Sub
LoadError:
MsgBox Err & " " & Error$
End
End Sub
Private Sub cmdCreateGroup_Click()
Dim newGroup As GROUP
Dim thePID As String
On Error GoTo ChangeError
If txtGroupName = "" Then Error 32765
thePID = txtGroupName
If Len(thePID) > 20 Then
thePID = Left$(thePID, 20)
Else
Do While Len(thePID) < 4
thePID = thePID & "_"
Loop
End If
Set newGroup = DBEngine.Workspaces(0).CreateGroup(txtGroupName, thePID)
DBEngine.Workspaces(0).Groups.Append newGroup
MsgBox "Group " & txtGroupName & " created", vbInformation
txtGroupName = ""
Exit Sub
ChangeError:
Dim msg As String
Select Case Err.Number
Case 3390
msg = "There is already a group named " & txtGroupName
Case 32765
msg = "You have not entered a group name"
Case Else
msg = Err.Description
End Select
MsgBox msg, vbExclamation
End Sub
Private Sub cmdClose_Click()
End
End Sub